#include "pch.h"

#include "iosystem/assignmentlist.h"



namespace IO
{
	//////////////////////////////////////////////////////////////////////////
	RE_ImplementSingleton(IO::AssignmentList);



	//////////////////////////////////////////////////////////////////////////
	void AssignmentList::Setup()
	{
		AssignmentList * self = AssignmentList::GetInstance();

		// basic home directories
		self->Add(Assignment("home", FileSystem::GetHomeDirectory()));
		self->Add(Assignment("bin", FileSystem::GetBinDirectory()));
		self->Add(Assignment("user", FileSystem::GetUserDirectory()));
		

		// and some useful and also necessary engine directories
		self->Add(Assignment("media", FileSystem::GetHomeDirectory() + "media/"));
		self->Add(Assignment("audio", FileSystem::GetHomeDirectory() + "media/audio/"));
		self->Add(Assignment("scripts", FileSystem::GetHomeDirectory() + "media/scripts/"));
		self->Add(Assignment("meshes", FileSystem::GetHomeDirectory() + "media/meshes/"));
		self->Add(Assignment("chars", FileSystem::GetHomeDirectory() + "media/chars/"));
		self->Add(Assignment("tex", FileSystem::GetHomeDirectory() + "media/textures/"));
		self->Add(Assignment("shader", FileSystem::GetHomeDirectory() + "media/shaders/"));
		self->Add(Assignment("db", FileSystem::GetHomeDirectory() + "media/db/"));
	}





	//////////////////////////////////////////////////////////////////////////
	AssignmentList::AssignmentList()
	{
		RE_CreateSingleton();

		this->m_assigns.Reserve(32);
	}


	//////////////////////////////////////////////////////////////////////////
	AssignmentList::~AssignmentList()
	{
		RE_DestroySingleton();
	}





	//////////////////////////////////////////////////////////////////////////
	void AssignmentList::Add(const Assignment & element)
	{
		this->m_assigns.Add(element);
	}


	//////////////////////////////////////////////////////////////////////////
	const Assignment & AssignmentList::AssignmentAtIndex(tIndex index) const 
	{
		return this->m_assigns[index];
	}


	//////////////////////////////////////////////////////////////////////////
	const Helper::String & AssignmentList::SchemeAtIndex(tIndex index) const 
	{
		return this->m_assigns[index].Scheme();
	}


	//////////////////////////////////////////////////////////////////////////
	const Helper::String & AssignmentList::PathAtIndex(tIndex index) const 
	{
		return this->m_assigns[index].Path();
	}

}